Skip to content

Conversation

Ahalya-ni
Copy link
Collaborator

@Ahalya-ni Ahalya-ni commented Oct 10, 2025

Pull Request

🤨 Rationale

User Story 3283281: FE | Handle filter transformation in Query builder
Task 3249469: Add source filter support to alarms query builder

This PR adds support for source filtering in the alarms query builder component.

👩‍💻 Implementation

  • Added a source constant to AlarmsQueryBuilderFields, including its data field, label, and supported filtering operators.
  • To support filtering, since source must be accessed within the properties object, any filter using source is transformed to the format: properties.system <operator> <value> || properties.minionId <operator> <value>.
  • Created a file called SourceProperties.constant to store the custom properties for reusability.
  • Exported the method from query-builder.utils.ts previously named getLogicalOperator to be used for combining system and minionId expressions.
  • Moved getConcatOperatorForMultiExpression below multipleValuesQuery since it is now a public method; this file is organized with public methods at the top and private methods below.
  • Renamed getLogicalOperator to getConcatOperatorForMultiExpression to better reflect its purpose, as it is used for combining multi-value expressions (e.g., {value1, value2}) as well as conditions like those used for source (system and minionId expressions).
  • Updated the getConcatOperatorForMultiExpression to return logical OR for isnotblank operator as its transformation logic is already in place.
image

Another approach

Another approach I considered was introducing separate query builder operators to handle source-related transformations directly within the expression builder callback of the query builder. This alternative did work, but it has a drawback: the resulting source expressions (such as (properties.system = "test-source" || properties.minionId = "test-source")) are not parsed by the query builder, which leads to an empty expression in the reader callback. For more details, refer to the prototype and the relevant branch.

🧪 Testing

Added unit tests

✅ Checklist

Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
@Ahalya-ni Ahalya-ni changed the base branch from main to users/ahalya/refactor/ahalya/move-reusable-to-utils October 10, 2025 10:49
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from 8a0c1e1 to 0825cd9 Compare October 10, 2025 12:36
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
@Ahalya-ni Ahalya-ni requested a review from manisha-ni October 10, 2025 12:49
… into users/ahalya/refactor/ahalya/move-reusable-to-utils
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from b285e8d to 6781f63 Compare October 13, 2025 06:45
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from 6781f63 to 471fba2 Compare October 14, 2025 06:24
@Ahalya-ni Ahalya-ni requested a review from manisha-ni October 14, 2025 06:27
@Ahalya-ni Ahalya-ni marked this pull request as ready for review October 14, 2025 10:18
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
@Ahalya-ni Ahalya-ni marked this pull request as draft October 14, 2025 11:36
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from 9420e47 to 78647b7 Compare October 14, 2025 11:43
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from f726b8c to e4f05e3 Compare October 16, 2025 06:26
Base automatically changed from users/ahalya/refactor/ahalya/move-reusable-to-utils to main October 16, 2025 06:52
… into users/ahalya/feat/alarms/source-filter-final-2.0
@Ahalya-ni Ahalya-ni merged commit 3754c6f into main Oct 16, 2025
1 check passed
@Ahalya-ni Ahalya-ni deleted the users/ahalya/feat/alarms/source-filter-final-2.0 branch October 16, 2025 07:04
Ahalya-ni pushed a commit that referenced this pull request Oct 16, 2025
## [4.21.0](v4.20.0...v4.21.0) (2025-10-16)

### Features

* **alarms:** Support filtering alarms by source ([#432](#432)) ([3754c6f](3754c6f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants